<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">  
<head>  
<title>{{ get_app_inf key="siteName" }} - {{ $title }}</title>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />  
<!-- add your meta tags here -->  
  
<link href="css/my_layout.css" rel="stylesheet" type="text/css" />
<link href="css/screen/permission.css" rel="stylesheet" type="text/css" />  
<!--[if lte IE 7]>  
<link href="css/my_patches/patch_my_layout.css" rel="stylesheet" type="text/css" />  
<![endif]-->  
<script type="text/javascript" src="script/jquery.js"><!-- jQuery 1.2.1 --></script>
<script type="text/javascript" src="script/jquery.form.js"><!-- 表单Ajax插件 --></script>
<script type="text/javascript" src="script/yav.js"><!-- 表单验证插件 --></script>
<script type="text/javascript" src="script/jquery.yav.pack.js"><!-- 表单验证插件 --></script>
<script type="text/javascript" src="script/jquery.confirm.js"><!-- 对话框插件 --></script>

<script type="text/javascript">


// 在网页载入时加载
$(function() {
	
	// 保存到数据库按钮变色
	$("input:button, input:submit").hover(function(){
		$(this).addClass("OMover");
	},function(){
		$(this).removeClass("OMover");
	});
	
	// 在鼠标悬停情况下显示编辑提示
	$(".controller").hover(function(){
		$(this).addClass("OMover");
		selectstr = ".controller[group_id='" + $(this).attr("group_id") + "']";
		if($(selectstr + " .editbox").html()==''){
			$(selectstr + " .tip").text(" ← 点击编辑别名");
		}
	},function(){
		$(this).removeClass("OMover");
		$(selectstr + " .tip").text("");
	});
	$(".action").hover(function(){
		$(this).addClass("OMover");
		selectstr = ".action[permission_id='" + $(this).attr("permission_id") + "']";
		if($(selectstr + " .editbox").html()==''){
			$(selectstr + " .tip").text(" ← 点击编辑别名");
		}
	},function(){
		$(this).removeClass("OMover");
		$(selectstr + " .tip").text("");
	});
	
	// 点击行时显示编辑表单
	$(".controller").click(function(){
		selectstr = ".controller[group_id='" + $(this).attr("group_id") + "']";
		if($(selectstr + " .editbox").html()==''){
			$(selectstr + " .tip").text("");
			_removeForms();
			$("#updategroup").appendTo(selectstr + " .editbox");
			// 预填写
			$("#group_aliasname").val($(selectstr + " .group_aliasname").text());
			$("#permission_group_id").val($(selectstr).attr("group_id"));
			$(".need_login[value='" + $(this).attr("need_login") + "']").attr("checked","checked");
		}
	});
	$(".action").click(function(){
		selectstr = ".action[permission_id='" + $(this).attr("permission_id") + "']";
		if($(selectstr + " .editbox").html()==''){
			$(selectstr + " .tip").text("");
			_removeForms();
			$("#updatepermission").appendTo(selectstr + " .editbox");
			// 预填写
			$("#permission_aliasname").val($(selectstr + " .permission_aliasname").text());
			$("#permission_id").val($(selectstr).attr("permission_id"));
		}
	});
	
	
	// 如果没有内容，则隐藏新增和删除控制器方法的容器
	if($("#newInFile li").text()==''){
		$("#newInFile").addClass("hideme");
	}
	if($("#removeFromFile li").text()==''){
		$("#removeFromFile").addClass("hideme");
	}
	
	// 当新增按钮被点击
	$("#bt_savetodb").click(function(){
		$.get("websetup.php",{
			controller : 'admin_permissions',
			action	   : 'permissionsave'
		},function(){
			location.reload();
		});
	});
	
	// 当删除按钮被点击
	$("#bt_removefromdb").click(function(){
		$.get("websetup.php",{
			controller : 'admin_permissions',
			action	   : 'permissionremove'
		},function(){
			location.reload();
		});
	});
	
	// 当取消按钮被点击
	$(".removeModifyForm").bind("click",function(){
		_removeForms();
	});
	
});

function _removeForms(){
	$("#updategroup").appendTo("#div_update");
	$("#updatepermission").appendTo("#div_update");
}

</script>

</head>  


<body> 
  <div id="page_margins">

    <div id="border-top">
      <div id="edge-tl"></div>
      <div id="edge-tr"></div>
    </div>
    <div id="page">
      {{ include file="admin/Websetup_header.html" }}
      {{ include file="admin/Websetup_nav.html" }}

      <div id="main">
        <div id="col1">
          <div id="col1_content" class="clearfix">
				{{ webcontrol type="menu" name="myMenu" }}
          </div>
        </div>
        <div id="col3">
          <div id="col3_content" class="clearfix">
            
				{{ include file = "admin/Websetup_permission_list.html" }}
            
          </div>
          <!-- IE Column Clearing -->
          <div id="ie_clearing"> &#160; </div>
        </div>
      </div>
      <!-- begin: #footer -->
      {{ include file="admin/Websetup_footer.html" }}
    </div>
    <div id="border-bottom">
      <div id="edge-bl"></div>
      <div id="edge-br"></div>
    </div>
  </div>
</body>
</html>
